<html lang="en">
<head>
    <title>游记明细管理</title>
    <#include "../common/header.ftl">
    <script type="text/javascript">
        $(function () {
            $(".lookBtn").click(function () {
                $("#inputModal .modal-body").empty();
                var id=$(this).data('id');
                $.get('/travel/getContentById',{id:id},function (data) {

                    $("#inputModal .modal-body").html(data.content);
                    $("#inputModal").modal('show');
                })
            })


            $(".updateStateBtn").click(function () {
                var id=$(this).data('id');
                var state=$(this).data('state');
                //console.log(state);
                $.post('/travel/updateState',{id:id,state:state},function (data) {
                    if(data.success){
                        $.messager.alert("温馨提示","操作成功,2S之后关闭");
                        setTimeout(function () {
                            window.location.reload();
                        },2000);
                    }
                })
            })


        })
    </script>
    <style>
        #inputModal img{
            width: 100%;
        }
    </style>
</head>
<body>
<!--左侧菜单回显变量设置-->
<#assign currentMenu="travel">

<div class="container-fluid " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">代审核游记页面管理</h1>
                </div>
            </div>
            <#setting number_format="#">
            <!--高级查询--->
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <select name="state" class="form-control">
                        <option value="1">待审核</option>
                        <option value="3">已拒绝</option>
                    </select>
                </div>
                <button id="btn_query" class="btn btn-default">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
            <#list pageInfo.list as t>
                <tr>
                    <td>${t_index+1}</td>
                    <td>${t.title}</td>
                    <td><img src="${t.coverUrl}" width="50"/></td>
                    <td>${t.dest.name}</td>
                    <td>${(t.author.nickname)!}</td>
                    <td>
                    ${t.state}
                    </td>
                    <td>
                        <a class="btn btn-info btn-xs updateStateBtn"  data-id="${t.id}" data-state="2">
                            <span class="glyphicon glyphicon-pencil"></span> 发布
                        </a>
                        <a class="btn btn-info btn-xs updateStateBtn"  data-id="${t.id}" data-state="3">
                            <span class="glyphicon glyphicon-pencil"></span> 拒绝
                        </a>
                        <a class="btn btn-info btn-xs lookBtn"  data-id="${t.id}" >
                            <span class="glyphicon glyphicon-pencil"></span> 查看文章
                        </a>
                    </td>
                </tr>
            </#list>
            </table>
            <#--分页-->
            <#include "../common/page.ftl"/>
        </div>
    </div>
</div>



<!-- 模态框必须作为body的子标签 -->
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">查看文章内容</h4>
            </div>
            <div class="modal-body">


            </div>
        </div>
    </div>
</div>


</body>
</html>